import util from 'node:util'
import { Transform } from 'node:stream'

util.inherits(Counter, Transform)

export default function Counter(options) {
  Transform.call(this, options)
  this.length = 0
}

Counter.prototype._transform = function (chunk, encoding, callback) {
  this.length += chunk.length
  this.push(chunk)
  callback()
}
